<extend name="Public/main" />
<block name="body">
	<div class="wrap J_check_wrap">
	
		<div class="h_a">excel数据确认<span style="color:red">为了是数据库的安全避免数据混乱</span></div>

		<form class="J_ajaxForm" action="" method="post">
			<div class="table_list">
			<table>
			<?php foreach ($excelshow as $key => $value): ?>
				
			
			<tr>
			<td><input type='checkbox' value = '{$key}'>第{$key}行</td>

				<?php foreach ($value as $k => $v): ?>
					
				<td>{$v}</td>
				

				<?php endforeach ?>

			</tr>
				
			<?php endforeach ?>	
			</table>
			

			</div>
			<div>
				<div class="btn_wrap_pd">
				 	<a id="btn-delete" class="btn" href="javascript:;">删除</a>  
					 <a class="btn" href="{:u('Sponser/insertexcel')}">确认正确</a>   
					 <a class="btn" href="{:u('Sponser/pushbyexcel')}">重新上传</a> 
					
			
			</div>
		</form>
	</div>
</block>
<block name="script">
	<script>
	$('table input:eq(0)').click(function(event) {
		if($(this).attr('checked')=="checked"){
	      $('table input[type=checkbox]').attr('checked','checked');
	       
	    }else{
	      $('table input[type=checkbox]').removeAttr('checked');
	    }
		
	});
		$('#btn-delete').click(function(event) {
			var convalue = "";
		 	 $("input[type=checkbox]").each(function(){
		    if($(this).attr('checked')=="checked"){
		       convalue += $(this).val();
		       convalue +=",";
		    }
	    
	 
	 	 });
		  if(!convalue){
		    alert('您没有选择数据');
		    return false;
		  }
		    $.ajax({
	    url: "{:U('Sponser/ajax_del_rows')}",
	    type: 'post',
	    dataType: 'html',
	    data: {convalue: convalue},
	    success:function (d){
	      if(d){
	       location.reload() 
	      }
	 
	    }
	  })
		
	});


	</script>
</block>